package id.co.rho.scoring.cid.framework.math.evaluator.model.visitor;

import id.co.rho.scoring.cid.framework.math.evaluator.model.MEValueNode;
import id.co.rho.scoring.cid.framework.math.evaluator.model.UnaryOpValueNode;

import java.math.BigDecimal;

/**
 * Created by IntelliJ IDEA.
 * User: bungrudi
 * Date: 9/14/11
 * Time: 4:30 PM
 */
public class NegationEvaluator implements NodeEvaluator {
    @Override
    public BigDecimal calculate(MEValueNode node, NodeWalkerExecutor context) {
        UnaryOpValueNode n = (UnaryOpValueNode) node;
        BigDecimal val = context.getResultMap().get(n.getOperand());
        return val.negate();
    }
}
